﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using StockManagement.Commands;
using System.Data;
using StockManagement.Models;
using StockManagement.Helper;

namespace StockManagement.ViewModels
{
    public class VendorViewModel:BaseViewModel
    {
        Vendor _vendor;
        public VendorViewModel()
        {
            _vendor = new Vendor();
        }

        public VendorViewModel(DataRow row)
        {
            _vendor = new Vendor(row);
        }

        public Guid VendorID
        {
            get { return _vendor.VendorID; }
        }

        public string FirstName
        {
            get { return _vendor.FirstName; }
            set
            {
                _vendor.FirstName = value;
                OnPropertyChanged("FirstName");
            }
        }
        public string LastName
        {
            get { return _vendor.LastName; }
            set
            {
                _vendor.LastName = value;
                OnPropertyChanged("LastName"); 
            }
        }

        public string CompleteName
        {
            get { return string.Format("{0} {1}",FirstName,LastName); }
        }

        public bool AddVendor()
        {
            return Adapter.AddNewVendor(_vendor);
        }
    }
}
